package com.mycompany.myapp.oss;

import cn.hutool.core.date.DateTime;
import java.util.UUID;
import org.apache.commons.io.FilenameUtils;

/**
 * 默认存储桶生成规则
 *
 */
public class BladeOssRule implements OssRule {

    /**
     * 租户模式
     */
    private final Boolean tenantMode;

    @Override
    public String bucketName(String bucketName) {
        return bucketName;
    }

    // prettier-ignore
	@Override
	public String fileName(String originalFilename) {
		return "upload" + "/" + DateTime.now().toString("yyyyMMdd") + "/" + UUID.randomUUID().toString() + "." + FilenameUtils.getExtension(originalFilename);
	}

    public BladeOssRule(Boolean tenantMode) {
        this.tenantMode = tenantMode;
    }
}
